
package vistas;
import BasesdDatos.BasesDatos;
import GestionVehiculo.Gestion;
import humanos.Usuario;
import java.sql.Connection;
import javax.swing.JFrame;
import javax.swing.JPanel;


public class JframeControl extends JFrame {
    
    private JframeControl EsteFrame;
    private JframeControl FramePadre;
    protected Gestion gestion;
    protected BasesDatos ControlBD;
    private Connection ConexionLocal;
    private Connection ConexionRemota;
   // protected HiloBaseDatos EsperaBD;

    
    
  public JframeControl(JframeControl padre,boolean Cerrable){
        //super(Titulo);

        if(Cerrable)
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);

        else{
            gestion = new Gestion();
        }

        this.setSize(800, 610);
        this.setResizable(false);
        this.setLocationRelativeTo(null);
        EsteFrame=this;
        FramePadre=padre;
        ControlBD = new BasesDatos();
        ConexionRemota = ControlBD.Conectar.RetornaConexion(true);
        ConexionLocal = ControlBD.Conectar.RetornaConexion(false);


    }  
    
     public void setPanel(JPanel Panel){
        this.setContentPane(Panel);
        this.setLocationRelativeTo(null);
        this.repaint();
    }
    
    public boolean TienePadre(){
        return (FramePadre!=null ? true : false );
    }

    public JframeControl getFramePadre(){
        return FramePadre;
    }

    public void RemueveTodo(){
        this.getContentPane().removeAll();
    }

    public BasesDatos getControlBD(){
        return ControlBD;
    }

    public Connection getLaConexion(){
        if(ConexionRemota!=null)
            return ConexionRemota;
        else
            return ConexionLocal;
    }

    public void setTransaccion(Gestion T){
        this.gestion = T;
    }

    
    
    
    
   
    
}
